<?php

namespace App\Http\Controllers\Backend;


use App\Manage\GoodsManage;
use App\Models\User;

class GoodsController extends BaseController
{

    // 快讯
    public function initialize()
    {
        parent::initialize();
    }

    // 父级
    // 添加，修改，删除，列表，停用 操作

    public function lists()
    {
        $options = ['is_admin_log' => 0, 'is_admin_role' => 0,];
        $logic   = new GoodsManage();

        // 执行
        $result = $logic->lists($this->myUser, $options);
        if($result === false){
            return $this->error($logic->getError());
        }

        return $this->success($result);
    }



    // 查找
    public function show()
    {
        $options = ['is_admin_log' => 0, 'is_admin_role' => 0,];
        $logic   = new GoodsManage();

        return $this->onShow($logic, $options);
    }

    // 删除
    public function del()
    {
        $options = ['is_admin_log' => 0, 'is_admin_role' => 0,];
        $logic   = new GoodsManage();

        return $this->onDel($logic, $options);
    }

    // 添加
    public function add()
    {
        $options = ['is_admin_log' => 0, 'is_admin_role' => 0,];
        $logic   = new GoodsManage();

        return $this->onAdd($logic, $options);
    }

    // 修改
    public function edit()
    {
        $options = ['is_admin_log' => 0, 'is_admin_role' => 0,];
        $logic   = new GoodsManage();

        return $this->onEdit($logic, $options);
    }

    // 状态
    public function status()
    {
        $options = ['is_admin_log' => 0, 'is_admin_role' => 0,];
        $logic   = new GoodsManage();

        return $this->onStatus($logic, $options);
    }

    // 排序
    public function rank()
    {
        $_value = $this->getData('rank', 0, 'intval');
        $this->throwIf(is_null($_value), '请填写排序数字！');

        return $this->changeField('rank', $_value);
    }

}


